package hongcaosp.app.android.modle.bean;

import android.text.TextUtils;

import xlj.lib.android.base.utils.DateUtil;
import xlj.lib.android.base.utils.JsonUtil;

public class Message implements IAtme,IMsgComment,IFans,IGooder,IMessageData {
//    	"id": 2, 用户id
//		"image": null,//用户头像
//                "nickname": "张三丰", //昵称
//                "getTime": 1544066968000, //时间
//                "isMeFollowmTa": 0, //我关注对方  0 是 1 否
//                "taFollowMe": 0,  //对方关注我   0 是 1 否
//                "videoId": null, //视频id
//                "coverPath": null, //封面
//                "videoPath": null, //视频地址
//                "typeChild": null, //1(赞评论/@评论),2(赞作品/@作品)
//                "commentId": null, //评论id
//                "getComment": null //评论内容


    private int id;
    private String image;
    private String nickname;
    private boolean meFollowmTa;
    private boolean taFollowMe;
    private int videoId;
    private String coverPath;
    private String videoPath;
    private int typeChild;
    private int commentId;
    private String comment;
    private String content;

    private long createTime;

    public long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(long createTime) {
        this.createTime = createTime;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public String getNickname() {
        return nickname;
    }

    @Override
    public String getDes() {
        return null;
    }

    @Override
    public String goodDes() {
        if (typeChild== 1) {
            return "赞了你的评论";
        } else if (typeChild == 2) {
            return "赞了你的作品";
        }
        return null;
    }

    @Override
    public String getCommentStr() {
        if (typeChild== 1) {
            return "回复了你的评论";
        } else if (typeChild == 2) {
            return "回复了你的作品";
        }
        return "";
    }

    @Override
    public String getTime() {
        return DateUtil.getChatTimeStr(createTime);
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public boolean isMeFollowmTa() {
        return meFollowmTa;
    }

    public void setMeFollowmTa(boolean meFollowmTa) {
        this.meFollowmTa = meFollowmTa;
    }

    public boolean isTaFollowMe() {
        return taFollowMe;
    }

    public void setTaFollowMe(boolean taFollowMe) {
        this.taFollowMe = taFollowMe;
    }

    public int getVideoId() {
        return videoId;
    }

    public void setVideoId(int videoId) {
        this.videoId = videoId;
    }

    public String getCoverPath() {
        return coverPath;
    }

    @Override
    public String getAtStr() {
        if (typeChild== 1) {
            return "@我的评论";
        } else if (typeChild == 2) {
            return "@我的作品";
        }
        return null;
    }

    public void setCoverPath(String coverPath) {
        this.coverPath = coverPath;
    }

    public String getVideoPath() {
        return videoPath;
    }

    public void setVideoPath(String videoPath) {
        this.videoPath = videoPath;
    }

    public int getTypeChild() {
        return typeChild;
    }

    public void setTypeChild(int typeChild) {
        this.typeChild = typeChild;
    }

    public int getCommentId() {
        return commentId;
    }

    public void setCommentId(int commentId) {
        this.commentId = commentId;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }


    @Override
    public long getUserId() {
        return id;
    }

    @Override
    public String getUserLogo() {
        return image;
    }

    @Override
    public String getUserName() {
        return nickname;
    }

    @Override
    public String getUserComment() {
        return comment;
    }

    @Override
    public boolean meFollowTa() {
        return meFollowmTa;
    }

    @Override
    public boolean taFollowMe() {
        return taFollowMe;
    }

    @Override
    public void setMeFollowTa(boolean isFollow) {
        setMeFollowmTa(isFollow);
    }

    @Override
    public int viewType() {
        return 0;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    private SM sm;

    public SM getSm() {
        if (sm == null && !TextUtils.isEmpty(content)) {
            try {
                sm = JsonUtil.parse(content,SM.class);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return sm;
    }
}
